package com.v5.mr.totalsalary;
import java.io.IOException;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.mapreduce.Reducer;

public class TotalSalaryReducer extends Reducer<LongWritable, Employee, LongWritable, LongWritable> {

	@Override
	protected void reduce(LongWritable k3, Iterable<Employee> v3,Context context)
			throws IOException, InterruptedException {
		//求每个部门的工资总额
		long total = 0;
		for(Employee e: v3){
			total = total + e.getSal();
		}
		
		//输出
		context.write(k3, new LongWritable(total));
	}
}
